package com.xdq.spring.service;

import com.xdq.spring.model.Skeleton;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

@Service
@Scope("singleton")
public class SkeletonProducer {

    private List<Skeleton> skeletons =new ArrayList<>();

    public SkeletonProducer(){
        System.out.println("SkeletonProducer被实例化了");
    }

    public List<Skeleton> produces(String type,int count){
        for(int i=0;i<count;i++){
            Skeleton skeleton=new Skeleton();
            skeleton.setMaterial("铝合金");
            skeleton.setCreateDate(String.valueOf(System.currentTimeMillis()));
            skeleton.setSerialNo(UUID.randomUUID().toString());
            skeletons.add(skeleton);
        }
        return skeletons;
    }
}
